﻿#ifndef AVFILESTOREABSTRACT_H
#define AVFILESTOREABSTRACT_H

#include <QObject>
#include <QHash>

class AVAudioConvert;

extern "C"
{
#include "libavformat/avformat.h"
};

class AVFileStoreAbstract : public QObject
{
    Q_OBJECT
public:
    explicit AVFileStoreAbstract(QObject *parent = nullptr);
    virtual ~AVFileStoreAbstract();

    virtual bool init() = 0;
    virtual bool destory() = 0;

    virtual bool fillFrame(AVFrame *frame) = 0;

protected:
    int m_defaultSampleRate;
    int m_defaultChannels;
    int m_defaultFormat;

    QHash<int,AVAudioConvert*> m_converts;

    bool resample(AVFrame *frame, uint8_t *buf, int *bytes, int *sampleSize);

signals:

public slots:
};

#endif // AVFILESTOREABSTRACT_H
